<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <style>
        body{
            text-align: center;
        }
    </style>
</head>
<body>
    
      <h1>
          <span id="minutes">10</span>
          <span>:</span>
          <span id="seconds">00</span>
      </h1>
      <div>
          <button id="begin">开始</button>
          <button id="reset"> 重置</button>
        </div>
</body>
<script>
    var time=600
    var minutes=parseInt( time/60)
    var seconds=time%60
  document.querySelector("#reset")
                .addEventListener('click',function(){
                    location.reload()
                })
                
    function timer(){ 
          //定义计时函数
      seconds--
       
    document.querySelector("#seconds").innerHTML=seconds
    if(seconds<=0){
        
        minutes--
        seconds=59 
        document.querySelector("#minutes").innerHTML=minutes
      
    }
      
     
   // document.getElementById('mytime').innerHTML=h+"时"+m+"分"+s+"秒"+ms+"毫秒";
   }


        document.querySelector("#begin")
                .addEventListener('click',function(){
                    var times=setInterval((timer),1000)
 
                })

               

</script>
</html>